/* 
 * File:   memory.c
 * Author: bjorn
 *
 * Created on September 2, 2007, 7:00 PM
 */

#include "memory.h"
#include <stdio.h>
#include <stdlib.h>

void * memory_allocate(size_t size) {
    void * result = calloc(1, size);
    if(!result) {
        printf("Not enough memory when trying to allocate. Abort!\n");
        exit(-1);
    }    
    return result;
}

void memory_free(void * pointer) {            
    free(pointer);    
}

void * memory_realloc(void * pointer, size_t size) {
    void * result = realloc(pointer, size);
        if(!result) {
        printf("Not enough memory when trying to reallocate. Abort!\n");
        exit(-1);
    }
    return result;
}
